#include "Log.h"
#include "StringHelper.h"

using namespace std;
using namespace log4cplus;

Logger GetLogger(const TChar *name)
{
	static bool init=false;
	if(!init)
	{
		PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("logConfig.properties"));
		init=true;
	}
	return log4cplus::Logger::getInstance(name);
}

#if UNICODE

void LogDiffCodeMsgW(Logger log,const wchar_t *msgFmt,const string &msg)
{
	wstring *wmsg=StringHelper::MultiByteToUnicode(msg);
	if(wmsg!=NULL)
	{
		LOG4CPLUS_DEBUG_FMT(log,msgFmt,wmsg->c_str());
		delete wmsg;
	}
}

#else

void LogDiffCodeMsgA(Logger log,const char *msgFmt,const std::string &msg)
{
	LOG4CPLUS_DEBUG_FMT(log,msgFmt,msg.c_str());
}

#endif